<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我喜欢你</title>
</head>
<body>
    <div id="app">

    </div>
    <script src="./lib/react.development.js"></script>
    <script src="./lib/react-dom.development.js"></script>
    <script src="./lib/babel.min.js"></script>
    <script type="text/babel">
        class Like extends React.Component{
            constructor() {
                super()
                this.state = {
                    flag: true
                }
            }
            handleClick = () => {
                const  { flag } = this.state
                this.setState({
                    flag: !flag
                })
            }
            render() {
                const  { flag } = this.state
                const msg = flag ? '我喜欢你' : '你喜欢我'
                const info = this.props.info
                return (
                    <h1 onClick={ this.handleClick }>{info}</h1>
                )
            }
        }
        ReactDOM.render(<Like info={'张三'} />,document.getElementById('app'))
    </script>
</body>
</html>